<!-- 流程编辑审批公共按钮 -->
<template>
	<view  class="" style="width: 100%; display: flex; padding: 0 20rpx;">
		<u-button v-if="nodeObj.isSubmit !== '1'" style="margin-right:20rpx; color: rgba(0,0,0,0.5000); width: 320rpx;" type="primary" text="退回" color= "rgba(0,0,0,0.0500)" :hairline="false" @tap="$u.debounce(onRefuseProcess, 500)"></u-button>
		<u-button type="primary" :disabled="disabled" text="提交审核" @tap="$u.debounce(onSubmit, 500)"></u-button>
	</view>
</template>
<script>
	export default {
		props: {
			nodeObj: {
				type: [Object],
				default: () => {}
			},
			model: {
				type: [Object],
				default: () => {}
			},
			resultObj: {
				type: [Object],
				default: () => {}
			},
			disabled: {
				type: [Boolean],
				default: false
			}
		},
		data() {
			return {
				
			}
		},
		onLoad(options) {
			
		},
		methods: {
			// 点击退回
			onRefuseProcess () {
				// this.$emit('onRefuseProcess')
				var that = this
				var nextnode = ''
				if(this.resultObj.transitionList){
					this.resultObj.transitionList.forEach(item => {
						nextnode += ',' + item.nextnode
					})
				}
				uni.navigateTo({
					url:'/pages/synergy/approval',
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						res.eventChannel.emit('acceptDataFromOpenerPage', {
							nodeObj: encodeURIComponent(JSON.stringify(that.nodeObj).replace(/%/g, '%25')),
							model: encodeURIComponent(JSON.stringify(that.model).replace(/%/g, '%25')),
							resultObj: encodeURIComponent(JSON.stringify(that.resultObj).replace(/%/g, '%25')),
							nextnode: nextnode,
							noAgree: '1'
							
						})
					}
				})
			},
			// 点击提交审核
			onSubmit () {
				this.$emit('onSubmit')
			},
		},
	}
</script>
<style lang="scss" scoped>

</style>
